package com.morphiastic.annotations;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;



@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.FIELD })
@Documented
/**
 * 
 * Used to embed an Entity inside a "parent" (containing) ElastiMorphed entity
 * 
 * 
 * see http://www.elasticsearch.org/guide/reference/mapping/object-type.html
 * for more details on the various available fields
 * 
 * 
 */
public @interface ElastiFieldEmbedded {

	
	
	
	/**
	 * @return Returns the field name as it will appear in the index. Defaults to the JavaBean property name.
	 */
	String name() default "";
	
	
	public enum Dynamic { TRUE, FALSE, STRICT};
	public enum Path {just_name, full }
	
	
	Dynamic dynamic() default Dynamic.TRUE;
	boolean enabled() default true;
	Path path() default Path.just_name;
	boolean includeInAll() default true;
	
	/**
	 * Maximum depth to go when a circular ref is encountered
	 * @return
	 */
	int circularRefMaxDepth() default 1;
	
	/**
	 * TODO develop this ... it is not yet implemented
	 * An array containing the names of the fields we want included in the embedded entity
	 * Defaults to an empty array wich means we want ALL of the annotated field of the embedded entity to be included in the index
	 * If the array is not empty, only the fields whose names (java attribute name) correspond to the ones in the array will indexed
	 * 
	 * This mechanism allows to limit the number of fields we want indexed in an embedded entity
	 * @return
	 */
	String[] includedFields() default {};
	
}
